﻿<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%!
/**
 * 预约挂号退费 对应的存储过程名称 -》预约挂号退费
 * @param params
 */
	public Message refundRegFee(Map<String, String> param) {
		Connection connection = null;
		CallableStatement statement = null;
		Message msg = new Message(0, "操作成功");
		java.sql.ResultSet rs = null;
		try {
			connection = getConn();
			statement = connection.prepareCall("{ Call 预约挂号退费(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) }"); 
			statement.setString(1, Tools.getDesc(param.get("sjh"), ""));
			statement.setString(2, "00");
			statement.setString(3, "0");
			statement.setString(4, "0");
			statement.setString(5, "");
			statement.setString(6, "");
			statement.setString(7, "0");
			statement.setString(8, "");
			statement.setString(9, "");
			statement.setString(10, "");
			statement.setString(11, "");
			statement.setString(12, "0");
			statement.setString(13, "1");
			statement.setString(14, "0");
			statement.setString(15, "1");
			statement.setString(16, "");
			rs = statement.executeQuery();
			String state = "";
			String message = "";
			while(rs.next()){
				state=rs.getString(1);
				message=rs.getString(2);
			}
			if("F".equalsIgnoreCase(state)) {
				msg.put("errcode",FAILURE);
				msg.put("errmsg",message);
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
					if(rs != null)
						rs.close();
					if (statement != null)
						statement.close(); 
					if (connection != null)
						connection.close(); 
				} catch (Exception e) {
					rs=null;
					statement=null;
					connection=null;
					e.printStackTrace();
				}
		}
		return msg;
	}
%>

<%
	Message msg = new Message();
	try {
		String sjh =  input.getDesc("sjh","");//收据号

		//预约挂号退费
		Map<String, String> param  = new HashMap<String,String>(2);
		param.put("sjh",sjh);
		msg=refundRegFee(param);
		msg.put("errcode",0);
    }catch (Exception e){
	   	msg.put("errcode",FAILURE);
    }
		out.println(msg);
%>